<?php

class Cicp_Vector3d_RgbColor extends Cicp_Vector3d
{
    function __construct($r, $g, $b)
    {
        $this->setIndexAlias('r', 0);
        $this->setIndexAlias('g', 1);
        $this->setIndexAlias('b', 2);
        $this->r = $r;
        $this->g = $g;
        $this->b = $b;
    }

    function __toString()
    {
        $v = $this->getDecimalVector();
        return round($v->r, 3) . ',' . round($v->g, 3) . ',' 
            . round($v->b, 3);
    }

    function getDecimalVector()
    {
        $v = $this->divide(255);
        return new Cicp_Vector3d_RgbColor($v->getValue(0),
                                          $v->getValue(1),
                                          $v->getValue(2));
    }
}